package com.jf.apply_car.controller;

import com.jf.apply_car.bean.Userinfo;
import com.jf.apply_car.service.MenuService;
import com.jf.apply_car.util.MyConstants;
import com.jf.apply_car.util.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class MenuController {
    @Autowired
    private MenuService menuService;

    @GetMapping("/menu/list")
    @ResponseBody
    public ResultJson list(HttpSession session) {
        Userinfo loginInfo = (Userinfo) session.getAttribute(MyConstants.LOGIN_SESSION_KEY);
        return menuService.getMenuList(loginInfo.getRoleId());
    }
}
